<?php 

class Ext_Shopping_Fetch_Parse_Adapter_Taobao extends Ext_Shopping_Fetch_Parse_Abstract
{
    public function parse()
    {
        $this->_datas['host'] = "taobao.com";

        if(preg_match("/item\.htm\?id=([0-9]+)/ui", $this->_url, $m) && $m[1]){      
             $this->_datas['viewId'] = $m[1];
             $this->_datas['url'] = "http://item.taobao.com/item.htm?id=".$m[1];
        }

        if(preg_match("/<input type=\"hidden\" name=\"title\" value=\"([^>]*?)\" \/>/ui", $this->_html, $m) && $m[1]){
            $this->_datas['name'] = $m[1];
        }

        if(preg_match("/<img id=\"J_ImgBooth\" src=\"([^>]*?)\"  data-hasZoom=\"700\" \/>/si", $this->_html, $m) && $m[1]){
            $this->_datas['photo'] = $m[1];
        }
        
        if(preg_match("/<input type=\"hidden\" name=\"current_price\" value= \"([0-9.]+)\" \/>/si", $this->_html, $m) && $m[1]){
            $this->_datas['price'] = $m[1];
        }
    }

}
